﻿using System;
using System.Collections.Generic;

namespace IupNET
{
    public class ZBox:Control
    {
        public ZBox(params Control[] children)
            : base(IntPtr.Zero)
        {
            List<IntPtr> chl = new List<IntPtr>();
            foreach(Control ctrl in children) 
                chl.Add(ctrl.cobject);
            chl.Add(IntPtr.Zero); //list needs to be NULL terminated
            Initialize(Iupc.Zboxv(chl.ToArray()));
        }

        public new Control Value
        {
            get
            {
                return GetHandle(GetAttribute("VALUE")) as Control;
            }

            set
            {
                SetAttribute("VALUE", value.HandleName);
            }
        }

        public int ValuePos
        {
            get
            {
                return Convert.StringToInt(GetAttribute("VALUEPOS"));
            }

            set
            {
                SetAttribute("VALUEPOS", value.ToString());
            }
        }

        public Alignment Alignment
        {
            get
            {
                return Convert.StringToAlignZBox(GetAttribute("ALIGNMENT"));
            }
            set
            {
                SetAttribute("ALIGNMENT", Convert.ZBoxAlignToString(value));
            }
        }
    }
}
